#ifndef NOTE_DIALOG_H
#define NOTE_DIALOG_H

#include "note.h"
#include "apptab.h"
class AppFrame;

//(*Headers(NoteDialog)
#include <wx/panel.h>
class wxTextCtrl;
class wxStaticText;
class wxFlexGridSizer;
class wxBoxSizer;
class wxButton;
//*)

class NoteDialog: public wxPanel, public AppTab
{
	public:

		NoteDialog(wxWindow* parent,AppFrame *top_frame, const Note& note);
		virtual ~NoteDialog();

        bool isModified() const;
        int  getID() const;
        void UpdateFonts();

		//(*Declarations(NoteDialog)
		wxButton* save_button;
		wxTextCtrl* text_box;
		wxButton* mark_keyword_button;
		wxButton* cancel_button;
		wxButton* reset_button;
		wxTextCtrl* manual_keywords_box;
		wxStaticText* date_label;
		wxStaticText* text_label;
		wxTextCtrl* caption_box;
		wxStaticText* keywords_label;
		wxButton* insert_keyword_button;
		wxTextCtrl* date_box;
		wxButton* insert_indirect_source_button;
		wxBoxSizer* top_sizer;
		wxButton* insert_source_button;
		wxStaticText* caption_label;
		//*)

	protected:
        Note note;
        AppFrame *top_frame;
        int last_text_len;  // previous text_box length, needed for EVT_TEXT handler to see if text was added / deleted

        //helper member to prevent handling text-updated events from within UpdateTextRange
        bool updating_text_style;

        void UpdateTextRange(int from, int to);

		//(*Identifiers(NoteDialog)
		static const long ID_STATICTEXT1;
		static const long ID_CAPTION;
		static const long ID_STATICTEXT2;
		static const long ID_DATE;
		static const long ID_STATICTEXT3;
		static const long ID_MANUAL_KEYWORDS;
		static const long ID_STATICTEXT4;
		static const long ID_TEXT;
		static const long ID_INSERT_SOURCE;
		static const long ID_INDIRECT_SOURCE;
		static const long ID_INSERT_KEYWORD;
		static const long ID_MARK_KEYWORD;
		static const long ID_RESET;
		//*)

	private:

		//(*Handlers(NoteDialog)
		void OnDateModified(wxCommandEvent& event);
		void OnKeywordsModified(wxCommandEvent& event);
		void OnInsertSource(wxCommandEvent& event);
		void OnInsertIndirectSource(wxCommandEvent& event);
		void OnMarkKeyword(wxCommandEvent& event);
		void OnCancel(wxCommandEvent& event);
		void OnSave(wxCommandEvent& event);
		void OnReset(wxCommandEvent& event);
		void Ontext_boxText(wxCommandEvent& event);
		void OnInsertKeyword(wxCommandEvent& event);
		void OnTextChanged(wxCommandEvent& event);
		//*)
		void OnChildKeyDown(wxKeyEvent& event);

		DECLARE_EVENT_TABLE()
};

#endif
